package com.example.lifecycle

import android.app.Activity
import android.content.Context
import android.content.Intent
import android.util.Log
import android.view.View
import android.widget.Button
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleObserver
import androidx.lifecycle.OnLifecycleEvent

class MyLifeCycleListener:LifecycleObserver {
    var context : Activity?=null
    var listener : OnLocationChangeListener?=null
    constructor(context: Activity, listener: OnLocationChangeListener){
        initLoc()
        this.context = context
        this.listener = listener
    }
    constructor()
    @OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
    private fun startLoc(){
        Log.e("zzm debug","startLoc")
    }

    @OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
    private fun stopLoc(){
        Log.e("zzm debug","stopLoc")
    }

    interface OnLocationChangeListener{
        fun onChange(lat:Double,long:Double)
    }

    fun initLoc(){
        Log.e("zzm debug","initLoc")
    }
}